#include<iostream>
#include<cstring>
using namespace std;
const int M = 1e9+7;
typedef long long LL;
int ans = 0;
LL n;
// F = A^k
struct matrix{
    int mtx[3][3];
    matrix(){memset(mtx, 0, sizeof mtx);}
}F, A;

matrix mul(matrix& a, matrix& b){
    matrix t;
    for(int i = 1; i <= 2; i++){
        for(int j = 1; j <= 2; j++){
            for(int k = 1; k <= 2; k++){
                t.mtx[i][j] = ((LL)t.mtx[i][j] + (LL)a.mtx[i][k] * b.mtx[k][j]) % M;
            }
        }
    }
    return t;
}

void qmi(matrix A, int k){
    // [F1 F2] * A^(n-1)  == [1 1] * A^(n-1) == [Fn, Fn+1]
    F.mtx[1][1] = F.mtx[1][2] = 1;
    A.mtx[1][2] = A.mtx[2][1] = A.mtx[2][2] = 1;
    while(k){
        if(k & 1){
            F = mul(F, A);
        }
        // A每轮都要 乘
        A = mul(A, A);
        k >>= 1;
    }
}

int main(){
    cin >> n;
    if(n <= 2) {
        cout << 1;
        return 0;
    }
    qmi(A, n-1);
    //[1 1]
    //[0 0] * A^(n-1)
    cout << F.mtx[1][1];
}